// Decompiled by DJ v2.9.9.60 Copyright 2000 Atanas Neshkov  Date: 2004-11-10 13:30:14
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   N_N4_APPROVE.java

package nc.bs.pub.action;

import nc.vo.pub.BusinessException;
//import java.util.Hashtable;
import java.util.Vector;

import nc.bs.pub.compiler.AbstractCompiler;
//import nc.bs.pub.pf.PfUtilTools;
import nc.impl.cdm.contract.ContractServiceImpl;
import nc.vo.cdm.contract.ContractVO;
//import nc.vo.pub.AggregatedValueObject;
import nc.vo.pub.compiler.PfParameterVO;
//import nc.vo.pub.lang.UFDateTime;

public class N_N4_APPROVE extends AbstractCompiler {

	public N_N4_APPROVE() {
//		m_methodReturnHas = new Hashtable();
		m_tmpVo = null;
//		m_keyHas = null;
	}

//	private AggregatedValueObject changeData(AggregatedValueObject aggregatedvalueobject, String s, String s1) throws BusinessException {
//		return PfUtilTools.runChangeData(s, s1, aggregatedvalueobject);
//	}
//
//	private AggregatedValueObject[] changeDataAry(AggregatedValueObject aaggregatedvalueobject[], String s, String s1) throws BusinessException {
//		return PfUtilTools.runChangeDataAry(s, s1, aaggregatedvalueobject);
//	}
//
//	private String getBillType() {
//		return m_tmpVo.m_billType;
//	}

	public String getCodeRemark() {
		return "\t//####\u672C\u811A\u672C\u5FC5\u987B\u542B\u6709\u8FD4\u56DE\u503C,\u8FD4\u56DEDLG\u548CPNL\u7684\u7EC4\u4EF6\u4E0D\u5141\u8BB8\u6709\u8FD4\u56DE\u503C####\n\tObject retObj=null;\n\t\n\t//####\u8BE5\u7EC4\u4EF6\u4E3A\u5355\u52A8\u4F5C\u5DE5\u4F5C\u6D41\u5904\u7406\u5F00\u59CB...\u4E0D\u80FD\u8FDB\u884C\u4FEE\u6539####\n\tprocActionFlow@@;\n\t//####\u8BE5\u7EC4\u4EF6\u4E3A\u5355\u52A8\u4F5C\u5DE5\u4F5C\u6D41\u5904\u7406\u7ED3\u675F...\u4E0D\u80FD\u8FDB\u884C\u4FEE\u6539####\n\treturn null;\n";
	}

//	private UFDateTime getUserDate() {
//		return new UFDateTime(m_tmpVo.m_currentDate);
//	}
//
//	private Object getUserObj() {
//		return m_tmpVo.m_userObj;
//	}
//
//	private Object[] getUserObjAry() {
//		return m_tmpVo.m_userObjs;
//	}
//
//	private AggregatedValueObject getVo() {
//		return m_tmpVo.m_preValueVo;
//	}
//
//	private AggregatedValueObject[] getVos() {
//		return m_tmpVo.m_preValueVos;
//	}

	public Object runComClass(PfParameterVO pfparametervo) throws BusinessException {
		m_tmpVo = pfparametervo;
		ContractVO billVO = (ContractVO) m_tmpVo.m_preValueVo.getParentVO();
		billVO.setAttributeValue(ContractVO.VERIFYMAN, m_tmpVo.m_operator);
		billVO.setAttributeValue(ContractVO.VERIFYDATE, m_tmpVo.m_currentDate.substring(0, 10));
		
		billVO.convertToMasterPK();

		ContractServiceImpl contBO = new ContractServiceImpl();
		contBO.validateApproveEnabled(billVO);

		billVO.convertToDetailPK();
		try {
			Object obj = procActionFlow(pfparametervo);
	
			billVO.convertToMasterPK();
			if (obj != null) {
				return obj;
			} else {
				String ccMessage = contBO.ccSysApprove(billVO);
				String cdmMsg = contBO.approved(billVO);
	
				Vector<String> msg = new Vector<String>();
				if (cdmMsg != null) {
					msg.add(cdmMsg);
				}
				if (ccMessage != null) {
					msg.add(ccMessage);
				}
	
				Object[] retMsg = msg.toArray(new String[0]);
				if (retMsg == null || retMsg.length == 0) {
					return null;
				} else {
					return retMsg;
				}
			}
		} catch (BusinessException e) {
			throw e;
		} catch (Exception e){
			throw new BusinessException(e.getMessage(),e);
		}
	}

//	private void setParameter(String s, Object obj) {
//		if (m_keyHas == null)
//			m_keyHas = new Hashtable();
//		if (obj != null)
//			m_keyHas.put(s, obj);
//	}
//
//	private void setUserObj(Object obj) {
//		m_tmpVo.m_userObj = obj;
//	}
//
//	private void setVo(AggregatedValueObject aggregatedvalueobject) {
//		m_tmpVo.m_preValueVo = aggregatedvalueobject;
//	}
//
//	private void setVos(AggregatedValueObject aaggregatedvalueobject[]) {
//		m_tmpVo.m_preValueVos = aaggregatedvalueobject;
//	}

//	private Hashtable m_methodReturnHas;
	private PfParameterVO m_tmpVo;
//	private Hashtable m_keyHas;
}